Ext.define('AM.view.PerformanceView', {
		extend: 'Ext.grid.Panel',
		alias : 'widget.performanceView',
		store : 'MyPerformanceStore',
		columnLines:true,
//		selModel : Ext.create('Ext.selection.CheckboxModel'), 
    	dockedItems: [{
        xtype: 'pagingtoolbar',
        dock: 'bottom',
        store : 'MyPerformanceStore',
        displayInfo: true
        },{
	     dock: 'top',
	     xtype: 'toolbar',
	     items: [{
		     xtype : "combobox",
		     allowBlank:false,
		     emptyText:'请选择科室',
			 selectOnFocus:true,
			 forceSelection: true,
			 queryMode: 'local',
			 labelWidth:30,
			 fieldLabel: '科室',
			 name: 'searchdepartment',
			 id:'search_123',
			 store :"DepartmentStore",
			 displayField: 'name',
			 valueField: 'id',
	         width : 200
	      },'-',' 查询日期: ', {
	        xtype:'datefield',
	        format:'Y-m',                    
	        id: 'performandate',            
	        width : 150
	      },'-', {
	            xtype: 'button',
	            text: '搜索',
	            icon : 'Ext/restful/images/find.png',
	            margin: '0 0 0 5',
	            handler: function () {
	                 var department= Ext.getCmp('search_123').getValue(); //获取文本框值
	                 var searchdate1 = Ext.getCmp('performandate').getValue();
	                 var grid=this.ownerCt.ownerCt;
	                 	grid.getStore().on('beforeload', function (store, options) {
	                                    var new_params = { sercherdepart:department, searchdate1:Ext.util.Format.date(searchdate1, 'Y-m')};
	                                    Ext.apply(store.proxy.extraParams, new_params);
	                                    });
	                                    grid.getStore().reload();
	                }
	        },{
	        	xtype: 'button',
	            text: '导出奖金',
	            icon : 'Ext/restful/images/down2.png',
	            margin: '0 0 0 15',
	            handler: function () {
	                 var department= Ext.getCmp('search_123').getValue(); //获取文本框值
	                 var searchdate = Ext.util.Format.date(Ext.getCmp('performandate').getValue(), 'Y-m');
	                 window.location.href ="Exportperformance?dept="+department+"&searchdate="+searchdate+" ";
	       		 }
	       }]
        }],
		columns: [
			        { text: 'ID', dataIndex: 'id',width:0,align:'center'},
			         {text: '序号', xtype: 'rownumberer',width:50,align:'center'},
			        { text: '姓名', dataIndex: 'employee', width:70,align:'center'},
			        { text: '程序化工作',columns: [
				        	{ text:'工作总数',dataIndex: 'chengxu', width:70,align:'center',xtype: 'numbercolumn', format:'0.00'},
			        	{text:'奖金', dataIndex:'CHXUreward',width:70,align:'center',xtype: 'numbercolumn', format:'0.00'}
			        ] },
				        {text: '项目化工作', columns: [
				        	{ text: '临时性工作',columns: [
					        	{ text: 'Ⅰ级得分', dataIndex: 'jinjizhongyao', width:90,align:'center', xtype: 'numbercolumn', format:'0.00'},
						        { text: 'Ⅱ级得分', dataIndex: 'jinjibuzhongyao', width:90,align:'center',xtype: 'numbercolumn', format:'0.00'},
						        { text: 'Ⅲ级得分', dataIndex: 'bujinjizhongyao', width:90,align:'center',xtype: 'numbercolumn', format:'0.00'},
						        { text: 'Ⅳ级得分', dataIndex: 'bujinjibuzhongyao', width:110,align:'center',xtype: 'numbercolumn', format:'0.00'}
				        	]},
//				        	{ text: '创新性工作',columns: [
//					        	 { text: '得分', dataIndex: 'chuangxin',width:90,align:'center',xtype: 'numbercolumn', format:'0.00'}
//				        	]},
					        { text: '总分', dataIndex: 'totalCount', width:60,align:'center',xtype:'numbercolumn', format:'0.00'},
					        { text: '奖金', dataIndex:'XMreward', width:80,align:'center',xtype: 'numbercolumn', format:'0.00'}
					      
			            
				       	]
			       	},
			        { text: '应发总奖金', dataIndex: 'reward', width:100,align:'center',xtype:'numbercolumn', format:'0.00'},
			        { text: '实发总奖金',dataIndex: 'actualreward',width:120,align:'center',xtype: 'numbercolumn', format:'0.00',summaryType: 'sum',
						     			summaryRenderer: function(value, summaryData, dataIndex) {
			                  return '合计：' + value ;
						     			}
				    },
			        { text: '日期', dataIndex: 'date',width:100,align:'center'}
			        
			     ]

})

	